package ycj.learn.spring.bean;

import ycj.learn.spring.common.Person;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value= "classpath:my-property.yml")
public class ConfigBeans03 {


    @Value("${person.name}")
    private String name;

    @Value("${person.age}")
    private int age;



    @Bean
    public Person person() {

        return new Person().setName(name).setAge(age);
    }
}
